<script type="text/javascript">
</script>
<head>
    <script src="js/cobros.js" type="text/javascript"></script>
    <script src="js/cajas.js" type="text/javascript"></script>
    <script src="js/monedas.js" type="text/javascript"></script>
    <script src="js/movimientos.js" type="text/javascript"></script>
</head>
<body >
    <table style="width: 100%;">
        <tr>
            <td style="width: 25%;">
                <h2>Cobros</h2></td>
            <td style="width: 65%;"></td>
            <td><div class="btnClose" onclick="hideCobros()">X</div></td>
        </tr>
    </table>
    <table id="cobros" border="0" style="width: 100%" >
        <tbody>
            <tr>
                <td>Cliente</td>
                <td>
                    <label id="lblCobrosClientes"></label>
                </td>
            </tr>
            <tr>
                <td>Tipo de pago</td>
                <td>
                    <select class="generalInput" id="cboCobrosTipoPago" onchange="getDetalleOcupacion()">
                        <option value=0>Efectivo</OPTION>
                        <option value=1>Credito</OPTION>
                        <option value=2>Debito</OPTION>
                        <option value=3>Transferencia</OPTION>
                    </select>
                </td>
            </tr>
            <tr>
                <td>Moneda</td>
                <td>
                    <select class="generalInput" id="cboCobrosMonedas" onchange="showCotizacion()">
                        <?php
                        require_once './src/MyDBi.php';
                        $db = new MysqliDb();


                        $results = $db->get('monedas');

                        if ($db->count > 0) {
                            foreach ($results as $row) {
                                echo '<option value="' . $row['IdMoneda'] . '-'. $row['Cotizacion'] .'">' . $row['Name'] . '</option>';
                            }
                        }
                        ?>
                    </select>
                </td>
                <td>Cotización</td>
                <td><input type="text" id="cobrosCotizacion" name="cobrosCotizacion" value="" onblur="updateCotizacion(this)" class="generalInput"/></td>
            </tr>
            <tr>

                <td>Importe</td>
                <td></td>
                <td></td>
                <td>
                    <input type="text" id="txtCobrosImporte" name="txtCobrosImporte" value="" onkeyup="calcularTotal(this);" class="generalInput"/>
                </td>
            </tr>
            <tr>
                <td>Descuento (%)</td>
                <td>
                    <input type="text" id="txtDescuentoPorc" name="txtDescuentoPorc" value="" onkeyup="calcularTotal(this);" class="generalInput"/>
                </td>
                <td></td>
                <td>
                    <input type="text" id="txtDescuentoCant" name="txtDescuentoCant" value="" onkeyup="calcularTotal(this);" class="generalInput"/>
                </td>
            </tr>
            <tr>
                <td></td>
                <td></td>
                <td></td>
                <td colspan="1" style="width: 100%; height: 1px; background-color: gray;"></td>
            </tr>
            <tr>
                <td>Total</td>
                <td></td>
                <td></td>
                <td colspan="1" style="font-size: 1.3em;font-weight: bold;color: #2d97af;">$<label id="txtCobrosTotal"></label></td>
            </tr>
            <tr>
                <td>Paga con</td>
                <td colspan="1">
                    <input type="text" id="txtCobrosPagaCon" name="txtCobrosPagaCon" onblur="calculaVuelto()" value="" class="generalInput"/>
                </td>
                <td colspan="1" style="font-size: 1.3em;font-weight: bold;color: #2d97af;">Vuelto de:</td><td><label id="txtVuelto"></label></td>
            </tr>
            <tr>

                <td colspan="1"></td><td><input type="button" value="Cobrar" name="save" onclick="saveCobro('n');" class="btnSave"/></td>
                <td colspan="1"></td><td><input type="button" value="A Cuenta" name="save" onclick="saveCobro('s');" class="btnSave"/></td>
            </tr>

    </table>
</td>
</tr>
</tbody>
</table>

</body>
